function ajaxSubmit(form){
    jQuery("#" + form).submit(function(event){
        event.preventDefault();
        formulario = jQuery(this);
        jQuery.ajax({
            url:formulario.attr('action'),
            dataType:'json',
            type:'POST',
            data: formulario.serialize() + '&ajax=' + formulario.attr('id'),
            success:function(data,textStatus,XMLHttpRequest){
                if(data != null && typeof data == 'object'){
                    jQuery.each(data, function(key,value){
                        jQuery().append(value);
                    });
                }
            }
        });
    });
}